package com.wx.plugin.mp.core;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * Created by zhou on 2016/11/28.
 */
public class WebAuthUrlUtil {
    public static final String getAuthUrl(String appid, String redirectUrl, String returnUrlargs){
        String result = "none";
        try {
            String encode = URLEncoder.encode(redirectUrl, "UTF-8");
            String returnUrl = URLEncoder.encode(returnUrlargs, "UTF-8");
            result = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appid+"&redirect_uri="+encode+"&response_type=code&scope=snsapi_base&state="+returnUrl+"#wechat_redirect";
            return result;
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
}
